﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MyAdmin/QuanLy.master" AutoEventWireup="true"
    CodeFile="LichSuMuaHang_AM.aspx.cs" Inherits="MyAdmin_LichSuMuaHang_AM" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <fieldset>
        <legend align="center" color="#F3CFB5"><b>Tìm Kiếm Lịch Sử Mua Hàng</b></legend>

        <table border="0" cellspacing="0" cellpadding="0" width="80%">
            <tr>
                <td align="right">
                    Từ Ngày
                </td>
                <td align="center">
                    <asp:Calendar ID="calTuNgayLap" runat="server" Width="200px" BackColor="White" 
                        BorderColor="#999999" CellPadding="4" DayNameFormat="Shortest" 
                        Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Height="180px">
                        <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
                        <NextPrevStyle VerticalAlign="Bottom" />
                        <OtherMonthDayStyle ForeColor="#808080" />
                        <SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
                        <SelectorStyle BackColor="#CCCCCC" />
                        <TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
                        <TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
                        <WeekendDayStyle BackColor="#FFFFCC" />
                    </asp:Calendar>
                </td>
            </tr>
            <tr>
                <td align="right">
                    Đến Ngày
                </td>
                <td align="center">
                    <asp:Calendar ID="calDenNgayLap" runat="server" Width="200px" BackColor="White" 
                        BorderColor="#999999" CellPadding="4" DayNameFormat="Shortest" 
                        Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Height="180px">
                        <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
                        <NextPrevStyle VerticalAlign="Bottom" />
                        <OtherMonthDayStyle ForeColor="#808080" />
                        <SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
                        <SelectorStyle BackColor="#CCCCCC" />
                        <TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
                        <TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
                        <WeekendDayStyle BackColor="#FFFFCC" />
                    </asp:Calendar>
                </td>
            </tr>
            <tr>
                <td align="right">
                    Giá Từ
                </td>
                <td align="center">
                    <asp:TextBox ID="txtGiaTu" runat="server" Width="52%"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="right">
                    Giá Đến
                </td>
                <td align="center">
                    <asp:TextBox ID="txtGiaDen" runat="server" Width="52%"></asp:TextBox>
                </td>
            </tr>
            <tr>
            <td></td>
                <td align="center">
                    <asp:Button ID="btnTimKiem" runat="server" Text="Tìm Kiếm" OnClick="btnTimKiem_Click" />
                </td>
            </tr>
        </table>
        <asp:Label ID="lblTBKhongTimThay" ForeColor="White" runat="server" Visible="false"
            Text="Không tìm thấy sản phẩm nào!"></asp:Label>
    </fieldset>
    <fieldset>
        <legend align="center" color="#F3CFB5"><b>Lịch Sử Mua Hàng</b></legend>        
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
    	<tr>
    		<td align="center">
             <asp:DetailsView ID="dtvLichSuMuaHang" runat="server" Height="50px" Width="50%" AutoGenerateRows="False"
            BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px"
            CellPadding="3" DataKeyNames="ID" DataSourceID="LQDSLichSuMuaHang" GridLines="Vertical"
            HeaderText="Lịch Sử Mua Hàng" OnItemInserted="dtvLichSuMuaHang_ItemInserted"
            OnItemUpdated="dtvLichSuMuaHang_ItemUpdated"           
            ondatabound="dtvLichSuMuaHang_DataBound">
            <AlternatingRowStyle BackColor="#DCDCDC" />
            <EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
            <Fields>
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                    SortExpression="ID" />
                <asp:TemplateField HeaderText="Ngày Lập Hóa Đơn">
                    <ItemTemplate>
                        <asp:Label ID="CreatedDateLABEL" runat="Server" Text='<%# Eval("NgayLapHoaDon", "{0:d}") %>' />
                    </ItemTemplate>
                    <InsertItemTemplate>
                        <asp:Label ID="CreatedDateForInsertLABEL" runat="server" Text='<%# Bind("NgayLapHoaDon") %>'
                            Visible="false"></asp:Label>
                        <asp:Calendar ID="CreatedDateInsertCALENDAR" runat="Server" OnSelectionChanged="CreatedDateInsertCALENDAR_SelectionChanged" />
                    </InsertItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="CreatedDateForEditLABEL" runat="server" Text='<%# Bind("NgayLapHoaDon") %>'
                            Visible="false"></asp:Label>
                        <asp:Calendar ID="CreatedDateEditCALENDAR" runat="Server" OnSelectionChanged="CreatedDateEditCALENDAR_SelectionChanged" />
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="TongTien" HeaderText="Tổng Tiền" SortExpression="TongTien" />
                <asp:TemplateField HeaderText="Khách Hàng">
                    <ItemTemplate>
                        <asp:Label ID="lblKhachHang" runat="server" Text='<%# Eval("TenKhachHang") %>' />
                        <br />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtTenKhachHang" Visible="false" runat="server" ReadOnly="true"
                            Text='<%# Bind("ID_Customer") %>' />
                        <asp:DropDownList ID="cbbKhachHang" runat="server" AutoPostBack="True" DataSourceID="LQDSKhachHang"
                            DataTextField="UserName" DataValueField="ID" HeaderText="Khách Hàng" OnDataBound="cbbKhachHang_DataBound"
                            OnSelectedIndexChanged="cbbKhachHang_SelectedIndexChanged">
                        </asp:DropDownList>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:CommandField CancelText="Hủy" EditText="Cập Nhật" InsertText="Thêm" NewText="Thêm"
                    ShowEditButton="True" ShowInsertButton="True" UpdateText="Cập Nhật" />
            </Fields>
            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
        </asp:DetailsView>
                <asp:Label runat="server" Text="Label" ID="lblThongBaoDTView" ForeColor="White" Visible="false" />
            </td>
    	</tr>
    </table>
    <br />
        <asp:GridView ID="gvDSLichSuMuaHang_AM" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px"
            CellPadding="3" DataKeyNames="ID" GridLines="Vertical" Width="100%" OnPageIndexChanging="gvDSLichSuMuaHang_AM_PageIndexChanging"
            OnSelectedIndexChanged="gvDSLichSuMuaHang_AM_SelectedIndexChanged">
            <AlternatingRowStyle BackColor="#DCDCDC" />
            <Columns>
                <asp:CommandField SelectText="Chọn" ShowSelectButton="True" />
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                    SortExpression="ID" />
                <asp:BoundField DataField="NgayLapHoaDon" HeaderText="Ngày Lập Hóa Đơn" SortExpression="NgayLapHoaDon" />
                <asp:BoundField DataField="TongTien" HeaderText="Tổng Tiền" SortExpression="TongTien" />
                <asp:BoundField DataField="TenKhachHang" HeaderText="Tên Khách Hàng" />
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:CheckBox ID="checkXoa" runat="server" AutoPostBack="True" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
            <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#0000A9" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#000065" />
        </asp:GridView>
        <table border="0" cellspacing="0" cellpadding="0" width="100%">
        	<tr>
        		<td align="right">
                  <asp:Label ID="lblThongBaoGridView" runat="server" ForeColor="White" Text="Label"></asp:Label>
                  <asp:Button ID="XoaNhieuBUTTON" runat="server" Text="Xóa Đã Chọn" OnClick="XoaNhieuBUTTON_Click" />      
                </td>
        	</tr>
        </table>            
      

        <asp:LinqDataSource ID="LQDSLichSuMuaHang" runat="server" ContextTypeName="DataAccess_Layer.DataClasses_RetailerDataContext"
            EntityTypeName="" TableName="LichSuMuaHangs" EnableDelete="True" EnableInsert="True"
            EnableUpdate="True" OnInserted="LQDSLichSuMuaHang_Inserted" OnSelecting="LQDSLichSuMuaHang_Selecting"
            OnUpdating="LQDSLichSuMuaHang_Updating">
        </asp:LinqDataSource>
        <asp:LinqDataSource ID="LQDSKhachHang" runat="server" ContextTypeName="DataAccess_Layer.DataClasses_RetailerDataContext"
            EntityTypeName="" Select="new (ID, UserName)" TableName="Customers">
        </asp:LinqDataSource>
    </fieldset>
</asp:Content>
